#define _CRT_SECURE_NO_WARNINGS

//8
//7 6
//6 5 5 4
//5 4 4 3 4 3 3 2
//4 3 3 2 3 2 2 1 3 2 2 1 2 1 1 0 
//3 2 2 1 2 1 1 0 2 1 1 0 1 0 1 2 1 1 0 1 0 1 1 0 1 1 0
//2 1 2 2 1 2 1 1 0 2 1 1 0 1 0 1 2 1 1 0 1 0 1 1 0 1 1 0
//3 2 3 3 2 3 2 2 1 3 2 2 1 2 1 2 3 2 2 1 2 1 2 2 1
//18 26 6

//1010
//1011
//1011

//#include <stdio.h>
//
//int MAX_div(int x, int y)
//{
//	int m = 0;
//	while (m = x % y)
//	{
//		x = y;
//		y = m;
//	}
//	return y;
//}
//int main()
//{
//	int a = 0, b = 0;
//	scanf("%d %d", &a, &b);
//	printf("%d\n", a * b / MAX_div(a, b));
//
//	return 0;
//}

#include <stdio.h>
#include <string.h>
#include <assert.h>

void reverse(char* pa, char* pb)
{
	assert(pa && pb);
	while (pa < pb)
	{
		int temp = *pa;
		*pa = *pb;
		*pb = temp;
		pa++;
		pb--;
	}
}
int main()
{
	char arr[100] = { 0 };
	fgets(arr, 100, stdin);
	int sz = strlen(arr);
	char* left = arr;
	char* right = arr + sz - 1;
	reverse(left, right);
	char* str = arr;
	char* cur = arr;
	while (*cur != '\0')
	{
		while (*cur != ' ' && *cur != '\0')
		{
			cur++;
		}
		reverse(str, cur - 1);
		str = cur + 1;
		if (*cur != '\0')
		{
			cur++;
		}
	}
	printf("%s\n", arr);

	return 0;
}